<template>
  <div>
    <!-- 面包屑导航 -->
    <v-bread></v-bread>
    <!-- 按钮 -->
    <el-button
      type="primary"
      plain
      size="small"
      @click="addDialog"
      ref="diainfo"
    >
      添加
    </el-button>
    <!-- 列表 -->
    <v-list @edit="edit"></v-list>
    <!-- 弹框 -->
    <v-dialog :seckInfo="seckInfo" @cancel="cancel" ref="diaInfo"></v-dialog>
  </div>
</template>

<script>
import vDialog from "./dialog.vue";
import vList from "./list.vue";
export default {
  data() {
    return {
      seckInfo: {
        isShow: false,
        isAdd: true,
      },
    };
  },
  components: {
    vDialog,
    vList,
  },
  methods: {
    // 添加
    addDialog() {
      this.seckInfo = {
        isShow: true,
        isAdd: true,
      };
    },
    cancel(e) {
      this.seckInfo.isShow = e;
    },
    edit(id) {
      // 改变弹窗状态
      this.seckInfo = {
        isShow: true,
        isAdd: false,
      };
      // console.log(id);
      // 调用子组件的方法
      this.$refs.diaInfo.lookup(id);
    },
  },
  computed: {},
  mounted() {},
};
</script>
<style lang=less scoped >
.el-button--small {
  margin-top: 15px;
  margin-bottom: 15px;
}
</style>
